/*
 * CSListRepresentation.cpp
 *
 * Copyright 2012 Fabian Wenzelmann
 *
 * This file is part of Recognition-Procedures-for-Boolean-Functions.
 *
 * Recognition-Procedures-for-Boolean-Functions is free software: you
 * can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * Recognition-Procedures-for-Boolean-Functions is distributed in the hope
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Recognition-Procedures-for-Boolean-Functions.
 *
 * If not, see <http://www.gnu.org/licenses/>.
 */

#include "bfr/CSListRepresentation.hpp"

#include <list>

#include "bfr/Literal.hpp"
#include "bfr/Clause.hpp"
#include "bfr/ClauseSet.hpp"

using std::list;

namespace bfr {

CSListRepresentation::CSListRepresentation()
    : content() { }

CSListRepresentation::CSListRepresentation(const ClauseSet &cs)
    : content() {
    for (ClauseSet::const_iterator it = cs.begin();
          it != cs.end();
          it++) {
        list<Literal> newClause;
        const Clause *clause = *it;
        for (Clause::const_iterator cIt = clause->begin();
             cIt != clause->end();
             cIt++) {
            newClause.push_back(Literal(*cIt));
        }
        content.push_back(newClause);
    }
}

void CSListRepresentation::addClause(const clause_t &clause) {
    content.push_back(clause);
}

CSListRepresentation::const_iterator CSListRepresentation::begin() const {
    return content.begin();
}

CSListRepresentation::const_iterator CSListRepresentation::end() const {
    return content.end();
}

}
